<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>数字翻动动画特效</title>

    <style>
        * {
            margin: 0;
            padding: 0;
        }

        .box {
            margin: 100px;
        }

        .statistics-container {
            display: inline-block;
            white-space: nowrap;
        }

        .statistics {
            display: inline-block;
            position: relative;
            width: 120px;
            height: 170px;
            line-height: 170px;
            margin: 0 5px;
            font-size: 120px;
            color: #fedec2;
            font-weight: bold;
        }

        .statistics-item {
            position: absolute;
            top: 0;
            left: 0;
            width: 100%;
            height: 100%;
            background-color: #e38538;
            border-radius: 10px;
        }

        .statistics-item-top {
            position: absolute;
            left: 0;
            top: 0;
            height: 50%;
            width: 100%;
            text-align: center;
            background-color: #e38538;
            border-bottom: 1px solid #e38538;
            border-radius: 10px 10px 0 0;
            box-sizing: border-box;
            overflow: hidden;
            z-index: 0;
        }

        .statistics-item-bottom {
            position: absolute;
            left: 0;
            bottom: 0;
            height: 50%;
            width: 100%;
            text-align: center;
            background-color: #e38538;
            border-bottom: 1px solid #e38538;
            border-radius: 0 0 10px 10px;
            box-sizing: border-box;
            overflow: hidden;
            z-index: 0;
        }

        .statistics-item-top>span {
            display: block;
        }

        .statistics-item-bottom>span {
            display: block;
            transform: translate(0, -50%);
        }

        @keyframes topScroll {
            0% {
                transform: perspective(400px) rotateX(0deg);
            }

            100% {
                transform: perspective(400px) rotateX(-90deg);
            }
        }

        @keyframes bottomScroll {
            0% {
                transform: perspective(400px) rotateX(90deg);
            }

            100% {
                transform: perspective(400px) rotateX(0deg);
            }
        }

        .statistics-item .statistics-item-top,
        .statistics-item .statistics-item-bottom,
        .statistics-item .statistics-item-top,
        .statistics-item .statistics-item-bottom {
            z-index: 0;
        }


        .statistics-item.active .statistics-item-top {
            z-index: 1;
        }

        .statistics-item.active .statistics-item-bottom {
            transform-origin: 50% 0%;
            animation: bottomScroll 0.3s 0.3s ease-out both;
            z-index: 2;
        }

        .statistics-item.previous .statistics-item-top {
            transform-origin: 50% 100%;
            animation: topScroll 0.3s ease-in both;
            z-index: 2;
            opacity: 1;
        }

        .statistics-item.previous .statistics-item-bottom {
            z-index: 1;
            opacity: 1;
        }
    </style>
</head>

<body>
    <div class="box"></div>
    <script src="./src/jquery-1.9.1.min.js"></script>
    <script src="./src/statistics.js"></script>
    <script>
        $('.box').statisticsAnimate({
            min: 0,
            max: 1111,
            time: 1000,
            len: 4,
            width: 100, // 宽度
            height: 160, // 高度
            fontSize: 100, // 字体大小
            margin: 10, // 字体间距
            color: '#FF1B1F', // 字体颜色
            background: '#fedec2' // 背景颜色
        });
    </script>
</body>

</html>